<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <form name="f1">
      <p>username <input type="text" name="username" value="lili" /></p>
      <p>
        <button type="button" name="submitBtn">提交</button>
      </p>
    </form>
    <script>
      const form = document.f1;
      form.submitBtn.onclick = function () {
        // 设置 username
        console.log(form.username.value);
        form.username.value = "jack";
        console.log(form.username.value);
      };
    </script>
  </body>
</html>
